package com.zxq.web.channel;

import com.zxq.exchange.enums.ETcpFrame;
import com.zxq.exchange.model.ExchangeDTO;
import com.zxq.exchange.register.INotifyPlatform;
import com.zxq.exchange.register.NotifyPlatformRegister;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@Slf4j
public class TcpChannel implements INotifyPlatform {

    @PostConstruct
    public void initRegister() {
        NotifyPlatformRegister.getInstance(ETcpFrame.modbus).registerNotify(this);
        NotifyPlatformRegister.getInstance(ETcpFrame.dlt645).registerNotify(this);
        NotifyPlatformRegister.getInstance(ETcpFrame.jt808).registerNotify(this);
    }

    @Override
    public void notifyPlatform(ExchangeDTO exchangeDTO) {
        log.info("rec dev:" + exchangeDTO.toString());

    }


}
